/*
 * Copyright (C) 2011 Mette Bank, Rikke Jensen, Kenneth Brodersen, Thomas Pedersen
 * 
 * This file is part of digiPECS.
 * 
 * digiPECS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * digiPECS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with digiPECS.  If not, see <http://www.gnu.org/licenses/>.
 */

package sw6.digipecs.widget;

import java.util.List;

import sw6.digipecs.model.ExtImage;
import sw6.digipecs.widget.dragdrop.DragLayout;
import android.content.Context;

/**
 * Adapter for dragable extended images. Extends ExtImageAdaper
 * and overrides createView to able to create views for drageble
 *  extended images.
 * @author sw6.digipecs
 *
 */
public class DragableExtImageAdapter extends ExtImageAdapter {
	//Used for for DragableExtImageView
	private DragLayout mDragLayout;

	/**
	 * Constructor - the constuctor will take the context we are
	 * working within, as this is needed to create a dragableExtImageView.
	 * Will also need a list of extImages for super class methods, 
	 * and a draglayout for setting the draglayout for the
	 * dragableExtImageView created in the createView method.
	 * @param context - the context that we are working within.
	 * @param images - list of extImages used for super class methods. 
	 * @param dl - draglayout associated with the view using this 
	 * adapter.
	 */
	public DragableExtImageAdapter(Context context, List<ExtImage> images, DragLayout dl) {
		super(context, images);		
		mDragLayout = dl;
	}
	
	/**
	 * Overrides the superclass method so a dragableExtImageView
	 * is created and returned, to suit dragebleExtImages.
	 * @see sw6.digipecs.widget.ExtImageAdapter#createView()
	 * @return DragableExtImageView - a view that is dragable.
	 */
	@Override
	protected ExtImageView createView() {
		DragableExtImageView imageView;
		imageView = new DragableExtImageView(mContext);
        imageView.setDragLayout(mDragLayout);
        
		return imageView;
	}

}
